package com.ruoyi.web.controller.my;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.kiku.service.IMySuperWordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: TT
 * @Date: 2025/8/20 10:20
 * @Description: 我的超话控制器
 * @Version: v1.0
 */
@RestController
@RequestMapping("/weibo/superTopic")
public class MySuperWordsController extends BaseController {
    @Autowired
    private IMySuperWordsService mySuperWordsService;
    /**
     * 获取我的超话列表
     * @return AjaxResult
     */
    @GetMapping("/myList")
    public AjaxResult getMySuperWordsList() {
        return success(mySuperWordsService.selectMySuperWordsList());
    }

    /**
     * 根据微博的cookie和超话id和超话名称进行超话签到
     * @param topicId 超话id
     * @param topicName 超话名称
     * @return String
     */
    @GetMapping("/sign")
    public AjaxResult mySuperTopicSign( String topicId, String topicName) {
        return success(mySuperWordsService.mySuperTopicSign( topicId, topicName));
    }
    /**
     * 根据微博的cookie进行批量超话签到
     * @return List<String>
     */
    @GetMapping("/batchSign")
    public AjaxResult batchSign() {
       List<String> results = mySuperWordsService.mySuperTopicBatchSign();
        return success(results);
    }
    /**
     * 验证微博的cookie是否有效
     * @return Integer
     */
    @GetMapping("/verify")
    public AjaxResult verifyWeiboCookie() {
       Integer result =mySuperWordsService.verifyWeiboCookie();
       return success(result);
    }

    /**
     * 设置微博的cookie
     * @param cookie token
     */
    @GetMapping("/setCookie")
    public AjaxResult setWeiboCookie(String cookie) {
        mySuperWordsService.setWeiboCookie(cookie);
        return success();
    }
    /**
     * 移除所有用户微博的cookie
     */
    @GetMapping("/removeAllCookie")
    public AjaxResult removeAllWeiboCookie() {
        mySuperWordsService.removeAllWeiboCookie();
        return success();
    }


}
